// serviceCenter.js
const app = getApp()
const util = require("../../utils/util.js")

Page({

  /**
   * 页面的初始数据
   */
  data: {
    swiperbox: app.globalData.swiperbox,
    swiper: app.globalData.swiper,

    balance: '0.0',

    memu: [
      {
        icon:'icon-dianpuguanli',
        title: '店铺管理',
        url: '../../pages/serviceShop/serviceShop'
      }, {
        icon: 'icon-shebeiguanli',
        title: '设备管理',
        url: '../../pages/serviceDevice/serviceDevice'
      }
    ],
    engMenu:[
      {
        icon: 'icon-dingdan3',
        title: '已维修单',
        url: '../../pages/serviceRepair/serviceRepair?status=2'
      }, {
        icon: 'icon-ico_jiudianguanli_shebeiweixiudengji',
        title: '未维修单',
        url: '../../pages/serviceRepair/serviceRepair?status=1'
      }
    ],
    saleEngMenu:[
      {
        icon: 'icon-navicon-srtj',        
        title: '收入统计',
        url: '../../pages/serviceOrder/serviceOrder'
      }
    ]
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    that.setData({
      userInfo: app.globalData.userInfo,
      swiper: wx.getStorageSync('swiper') || app.globalData.swiper,
    })
    var data = {};
    app.post("identity/index", data).then((res) => {
      if (res.code == 200) {
        var data = res.data;
        that.setData({
          balance: res.entity.account.balance
        })
      }
    }).catch((errMsg) => {
      console.log(errMsg);//错误提示信息
    })
  },
  withdraw: function () {
    var balance = this.data.balance;
    wx.navigateTo({
      url: '../../pages/proxyWithdraw/proxyWithdraw?balance=' + balance,
    })
  },
  onShow: function () {
    this.onLoad();
  },
})